<meta meta="用户升级配置" args="data"/>
<style>
    .upgrade-setting-table th {
        text-align: right;
    }
</style>
<form class="form-inline" id="baseForm" s="form,datac,nda,valid" s-data="data">
    <table class="table table-bordered table-striped table-condensed table-middle upgrade-setting-table">
        <caption>会员直升配置</caption>
        <tbody>
        <tr>
            <th style="width: 150px;">开启</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="openDirectlyUpgrade" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;">直升级别</th>
            <td>
                <select class="form-control ecomPlat input-sm" s="select"
                        name="directlyUpgradeLevel"
                        s-build="S.get('/api/enum/valuesMap/core.enums.UserLevel')">
                    <option value="">选择直升级别</option>
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<form class="form-inline" id="plusForm" s="form,datac,nda,valid" s-data="data.plus">
    <table class="table table-bordered table-striped table-condensed table-middle upgrade-setting-table">
        <caption>PLUS升级配置</caption>
        <tbody>
        <tr>
            <th style="width: 150px;">邀请好友数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="inviteUserNum" />
            </td>
            <th style="width: 150px;">分配会员费</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="allotUpgradeFee" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;">上级分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="fatherRewardFee" />
            </td>
            <th style="width: 150px;">上上级分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="grandRewardFee" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">运营商分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="carrierRewardFee" />
            </td>
            <th style="width: 150px;">上级运营商分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="carrierSuperRewardFee" />
            </td>
            <th style="width: 150px;">运营总监分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="chiefRewardFee" />
            </td>
            <th style="width: 150px;">上级运营总监分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="chiefSuperRewardFee" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">市代分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="cityAgentRewardFee" />
            </td>
            <th style="width: 150px;">区代分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="districtAgentRewardFee" />
            </td>
            <th style="width: 150px;">服务商分配金额</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="relationAgentRewardFee" />
            </td>
            <th style="width: 150px;">直推订单数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" value="0"
                       s-valid-error="require(),number(),min(0)" name="directOrderNum" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">使用现金升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useMoney" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;">使用积分升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useIntegral" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;"></th>
            <td>
            </td>
            <th style="width: 150px;"></th>
            <td>
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">月费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerMonth" />
            </td>
            <th style="width: 150px;">年费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerYear" />
            </td>
            <th style="width: 150px;">永久费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="priceForForever" />
            </td>
            <th style="width: 150px;">支付类型</th>
            <td>
                <select class="form-control" s="select"
                        s-build="S.get('/api/enum/valuesMap/core.enums.UserUpgradePayType')"
                        name="payType">
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<form class="form-inline" id="carrierForm" s="form,datac,nda,valid" s-data="data.carrier">
    <table class="table table-bordered table-striped table-condensed table-middle upgrade-setting-table">
        <caption>运营商升级配置</caption>
        <tbody>
        <tr>
            <th style="width: 150px;">直推PLUS会员数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0"
                       s-valid-error="require(),number(),min(0)" name="directPlusUserNum" />
            </td>
            <th style="width: 150px;">团队PLUS会员数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0"
                       s-valid-error="require(),number(),min(0)" name="teamPlusUserNum" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">使用现金升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useMoney" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;">使用积分升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useIntegral" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">月费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerMonth" />
            </td>
            <th style="width: 150px;">年费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerYear" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">永久费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="priceForForever" />
            </td>
            <th style="width: 150px;">支付类型</th>
            <td>
                <select class="form-control" s="select"
                        s-build="S.get('/api/enum/valuesMap/core.enums.UserUpgradePayType')"
                        name="payType">
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<form class="form-inline" id="chiefForm" s="form,datac,nda,valid" s-data="data.chief">
    <table class="table table-bordered table-striped table-condensed table-middle upgrade-setting-table">
        <caption>运营总监升级配置</caption>
        <tbody>
        <tr>
            <th style="width: 150px;">直推运营商数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0"
                       s-valid-error="require(),number(),min(0)" name="directCarrierNum" />
            </td>
            <th style="width: 150px;">团队运营商数量</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0"
                       s-valid-error="require(),number(),min(0)" name="teamCarrierNum" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">使用现金升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useMoney" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
            <th style="width: 150px;">使用积分升级</th>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useIntegral" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">月费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerMonth" />
            </td>
            <th style="width: 150px;">年费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="pricePerYear" />
            </td>
        </tr>
        <tr>
            <th style="width: 150px;">永久费用</th>
            <td>
                <input autocomplete="off" type="number" class="form-control" min="0" s-valid-error="require(),number(),min(0)" name="priceForForever" />
            </td>
            <th style="width: 150px;">支付类型</th>
            <td>
                <select class="form-control" s="select"
                        s-build="S.get('/api/enum/valuesMap/core.enums.UserUpgradePayType')"
                        name="payType">
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<script type="text/javascript">
    S.getContent = function () {
        var deferred = $.Deferred();
        $.when($plusForm.validate(), $carrierForm.validate(), $chiefForm.validate()).done(function() {
            var obj = Smart.serializeToObject($baseForm.node);
            obj.plus = Smart.serializeToObject($plusForm.node)
            obj.carrier = Smart.serializeToObject($carrierForm.node)
            obj.chief = Smart.serializeToObject($chiefForm.node)
            deferred.resolve(obj)
        })
        return deferred;
    }
</script>